home *** CD-ROM | disk | FTP | other *** search
- global gmovie, gorderlist, flag, hiliteline, currentselection, currentquant, currentname, ship, shippref, temprect, subprice, stax, quantcount, moviecount, titlecount, subtot, subtotal, mouseloc, position, disc
-
- on checkquant
- global flag, gorderlist
- set flag to 0
- repeat with t = 1 to count(gorderlist)
- set currentname to getPropAt(gorderlist, t)
- set currentquant to getProp(gorderlist, currentname)
- if currentselection = string(currentname) then
- queryquant()
- exit repeat
- end if
- end repeat
- if flag = 0 then
- addProp(gorderlist, string(currentselection), 1)
- formatlist()
- end if
- end
-
- on queryquant
- set currentquant to currentquant + 1
- setaProp(gorderlist, currentname, currentquant)
- set flag to 1
- formatlist()
- end
-
- on formatlist
- set templist to EMPTY
- set tempprodlist to EMPTY
- set temppricelist to EMPTY
- set temppricelist2 to EMPTY
- set tempsub to 0
- set subtot to 0
- set pricelist2 to EMPTY
- sort(gorderlist)
- repeat with t = 1 to count(gorderlist)
- set tempquant to getAt(gorderlist, t)
- if tempquant <= 0 then
- deleteProp(gorderlist, t)
- next repeat
- end if
- set currentitem to tempquant & " - "
- set tempname to getPropAt(gorderlist, t)
- put tempname after currentitem
- put string(currentitem) & RETURN after templist
- repeat with n = 1 to titlecount
- set priceline to getAt(pricelist, n)
- set lengthoftitle to the number of chars in priceline
- set testtitle to chars(priceline, 23, lengthoftitle)
- if testtitle = tempname then
- set tempprod to chars(priceline, 1, 3)
- put tempprod & RETURN after tempprodlist
- set valtempprice to chars(priceline, 16, 20)
- set tempprice to value(valtempprice * 1.00000999999999984)
- put "$" & tempprice & RETURN after temppricelist
- set tempprice2 to value(tempprice * tempquant * 1.00000999999999984)
- set tempsub to value(tempsub + tempprice2)
- put "$" & tempprice2 & RETURN after temppricelist2
- exit repeat
- end if
- end repeat
- end repeat
- set the text of cast "orderlist" to templist
- set the text of cast "prodnos" to tempprodlist
- set the text of cast "prices" to temppricelist
- set the text of cast "prices2" to temppricelist2
- set subtot to value(tempsub)
- end
-
- on calcsub
- set quantcount to 0
- set subtotal to 0
- set tempprice to 0
- repeat with t = 1 to count(gorderlist)
- set counter to getAt(gorderlist, t)
- set quantcount to quantcount + counter
- end repeat
- if quantcount >= 6 then
- set discrate to 0.25
- else
- if quantcount = 5 then
- set discrate to 0.19999999999999998
- else
- if quantcount = 4 then
- set discrate to 0.14999999999999999
- else
- if quantcount = 3 then
- set discrate to 0.09999999999999999
- else
- if quantcount <= 2 then
- set discrate to 0.0
- end if
- end if
- end if
- end if
- end if
- set disc to value(subtot * discrate)
- set the text of cast "discount" to "$" & disc
- set the text of cast "subtotal" to "$" & subtot
- end
-
- on calctax
- if the hilite of cast "State" = 1 then
- set stax to value(0.06 * subtot)
- else
- set stax to 0
- end if
- set the text of field "tax" to "$" & stax
- end
-
- on calctotal
- global subtot, disc, ship, stax
- if shippref = 1 then
- if (quantcount > 0) and (quantcount < 5) then
- set ship to 4.5
- set the text of cast "shipping" to "$4.50"
- else
- if (quantcount >= 5) and (quantcount < 9) then
- set ship to 5.5
- set the text of cast "shipping" to "$5.50"
- else
- if quantcount > 8 then
- set ship to 6.0
- set the text of cast "shipping" to "$6.00"
- end if
- end if
- end if
- end if
- if shippref = 2 then
- if (quantcount > 0) and (quantcount < 5) then
- set ship to 7.5
- set the text of cast "shipping" to "$7.50"
- else
- if (quantcount >= 5) and (quantcount < 9) then
- set ship to 8.5
- set the text of cast "shipping" to "$8.50"
- else
- if quantcount > 8 then
- set ship to 9.0
- set the text of cast "shipping" to "$9.00"
- end if
- end if
- end if
- end if
- if shippref = 3 then
- if (quantcount > 0) and (quantcount < 5) then
- set ship to 16.75
- set the text of cast "shipping" to "$16.75"
- else
- if (quantcount >= 5) and (quantcount < 9) then
- set ship to 18.0
- set the text of cast "shipping" to "$18.00"
- else
- if quantcount > 8 then
- set ship to 19.0
- set the text of cast "shipping" to "$19.00"
- end if
- end if
- end if
- end if
- set total to value(subtot - disc + ship + stax)
- set the text of cast "total" to "$" & total
- end
-
- on orderbrowse
- if not (hiliteline = the mouseLine) then
- set hiliteline to the mouseLine
- end if
- end
-
- on ordermod
- set position to 0
- if (mouseloc > 218) and (mouseloc < 396) then
- if mouseloc < 234 then
- set position to 1
- else
- if (mouseloc < 251) and (count(gorderlist) >= 2) then
- set position to 2
- else
- if (mouseloc < 267) and (count(gorderlist) >= 3) then
- set position to 3
- else
- if (mouseloc < 283) and (count(gorderlist) >= 4) then
- set position to 4
- else
- if (mouseloc < 299) and (count(gorderlist) >= 5) then
- set position to 5
- else
- if (mouseloc < 315) and (count(gorderlist) >= 6) then
- set position to 6
- else
- if (mouseloc < 331) and (count(gorderlist) >= 7) then
- set position to 7
- else
- if (mouseloc < 347) and (count(gorderlist) >= 8) then
- set position to 8
- else
- if (mouseloc < 363) and (count(gorderlist) >= 9) then
- set position to 9
- else
- if (mouseloc < 379) and (count(gorderlist) >= 10) then
- set position to 10
- else
- if (mouseloc < 396) and (count(gorderlist) >= 11) then
- set position to 11
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- if not (position = 0) then
- set currentname to getPropAt(gorderlist, position)
- set currentquant to getAt(gorderlist, position)
- hilite line position of field "orderlist"
- end if
- end
-
- on subtractorder
- if not (position = 0) then
- if currentquant = 1 then
- deleteProp(gorderlist, currentname)
- else
- set currentquant to currentquant - 1
- setaProp(gorderlist, currentname, currentquant)
- end if
- formatlist()
- calcsub()
- end if
- end
-